<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    
    <title>My JSP 'links.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
	<h1>链接管理</h1><br/>
	<a href="${pageContext.request.contextPath}/admin">返回管理</a>
	<html:form action="/admin/links" method="post">
		<table width="655" border="1">
			
				<tr>
					<td width="232">
						新增博客链接  名称:
					</td>
					<td colspan="3">
						<html:text property="name"></html:text>
					</td>
				</tr>
				<tr>
					<td width="232">
						新增博客链接  URL(必须以http://开头):
					</td>
					<td colspan="3">
						<html:text property="url"></html:text>
					</td>
				</tr>
				<tr>
					<td>
						输入链接  描述：
					</td>

					<td colspan="3">
						<html:text property="description"></html:text>

						<input type="hidden" name="method" value="addLinks" />
						<input type="submit" value="提交" />
					</td>
				</tr>
					
			
			<tr>
				<td>
					名称
				</td>
				<td width="94">
					URL
				</td>
				<td width="109">
					描述
				</td>
				<td width="192">
					管理
				</td>
				

			</tr>
			<c:forEach items="${links}" var="link">
				<tr>
					<td>
						<a href="${link.url }" >${link.name }</a>
					</td>
					<td>
						${link.url}
					</td>
					
					<td>
						${link.description }
					</td>
					<td>
						<a href="#${catg.id }">编辑</a>&nbsp;&nbsp;
						
						 <a href="${pageContext.request.contextPath}/admin/links/${link.id }"  onclick="if (confirm('你确定要删除这个分类吗？')) { var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f);f.name='categoryForm' ;f.method = 'POST'; f.action =this.href ;var m = document.createElement('input'); m.setAttribute('type', 'hidden'); m.setAttribute('name', 'method'); m.setAttribute('value', 'deleteLinks'); f.appendChild(m); f.submit(); };return false;"
						 >删除</a>
					</td>
				</tr>
			</c:forEach>
		</table>
</html:form>
	</body>
</html>
